package com.example.fw;

import java.io.IOException;
import java.util.Properties;

/**
 * Created with IntelliJ IDEA.
 * User: pshevchenko
 * Date: 06.03.13
 * Time: 17:47
 * To change this template use File | Settings | File Templates.
 */
public class ApplicationManager {

    private Properties properties;
    private ContactHelper contactHelper;
    private ProcessHelper processHelper;
    private AutoItHelper autoItHelper;

    public ApplicationManager(Properties properties) {
        this.properties = properties;
    }

    public void init() throws IOException {
        getProcessHelper().startAppUnderTest();
    }

    public void decompose() {
        getProcessHelper().stopAppUnderTest();
    }

    public ContactHelper getContactHelper() {

        if (contactHelper == null){
            contactHelper = new ContactHelper(this);
        }
        return contactHelper;

    }

    public ProcessHelper getProcessHelper() {

        if (processHelper == null){
            processHelper = new ProcessHelper(this);
        }
        return processHelper;

    }

    public AutoItHelper getAutoItHelper() {
        if (autoItHelper == null){
            autoItHelper = new AutoItHelper(this);
        }
        return autoItHelper;
    }

    public String getProperty(String s) {
        return properties.getProperty(s);
    }
}
